package com.ai.chat.mapper;

import com.ai.chat.entity.Conversation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ConversationMapper extends BaseMapper<Conversation> {
    /**
     * 根据用户ID查询对话列表
     * @param userId 用户ID
     * @return 对话列表
     */
    @Select("SELECT * FROM t_conversation WHERE user_id = #{userId} AND is_deleted = 0 ORDER BY update_time DESC")
    List<Conversation> selectByUserId(Long userId);
}